<div class="navigate">
	<div class="L"></div>
    <div class="C">
    	<a class="home" href="/" lang="<?=$array_lang[$lang_id][0]?>"><?=tdt('Trang_chu')?></a><img src="<?=$theme_imagepath?>navigate_icon.gif" />
        <span lang="<?=$array_lang[$lang_id][0]?>"><?=tdt('Danh_gia')?></span>
	</div>
	<div class="R"></div>
</div>
<?
$sqlSelect = '';
$sqlWhere = '';
for ($i=1;$i<=6;$i++)
{
	$sqlSelect .= ', AVG(per_poll_' . $i . ') AS poll_' . $i;
	$sqlWhere .= ' AND per_poll_' . $i . ' > 0';
}
$db_select = new db_query('SELECT COUNT(*) AS count' . $sqlSelect . ' FROM poll_estimate_rates WHERE per_active = 1 ' . $sqlWhere . ' AND lang_id = ' . $lang_id);
$row = mysql_fetch_array($db_select->result);
unset($db_select);
?>
<div class="module_top"><div class="fl"></div><div class="fr"></div></div>
<div class="padding module_larger_border">
	<div class="estimate_result">
    	<table align="center" class="table" cellpadding="0" cellspacing="0">
        <tr class="title">
        	<td lang="<?=$array_lang[$lang_id][0]?>"><?=tdt('Tieu_chi_danh_gia')?></td>
            <td lang="<?=$array_lang[$lang_id][0]?>"><?=tdt('Diem_trung_binh')?></td>
		</tr>
        <? foreach ($arrPollEstimate as $key => $value) {?>
        <tr>
        	<td class="col_left<?=($key == 6)?' total':''?>" lang="<?=$array_lang[$lang_id][0]?>"><?=$value?></td>
            <td class="col_right<?=($key == 6)?' total':''?>"><script>generateVote(<?=$row['poll_' . $key]?>)</script> <span class="star"><?=$row['poll_' . $key]?></span></td>
		</tr>
        <? }?>
        <tr>
        	<td class="bottom" colspan="2">
            	<div class="fl"><span lang="<?=$array_lang[$lang_id][0]?>"><?=tdt('So_luot_binh_chon')?></span>: <?=$row['count']?></div>
                <div class="fr"><a href="#estimate_form"><span lang="<?=$array_lang[$lang_id][0]?>"><?=tdt('Gui_danh_gia')?></span><img src="<?=$theme_imagepath?>icon_poll.gif" /></a></div>
			</td>
		</tr>
        </table>
    </div>
    <div class="break_module"></div>
    <div class="estimate_list"></div>
</div>
<div class="module_bottom"><div class="fl"></div><div class="fr"></div></div>
<div id="estimate_form" class="module_larger_title">
	<div class="L"></div>
    <div class="C"><a href="#estimate_form" lang="<?=$array_lang[$lang_id][0]?>"><?=tdt('Gui_danh_gia')?></a></div>
    <div class="R"></div>
</div>
<div class="module_larger padding">
<?
$form = new form();
$form->create_form('estimate', $gs_action, 'post', '', '');
$form->add_javascript($con_root_path . "js/library.php", "");
?>
<div class="estimate_form">
	<table align="center" class="table" cellpadding="0" cellspacing="0">
    <tr class="title title_bg">
    	<td class="text" rowspan="2" lang="<?=$array_lang[$lang_id][0]?>"><?=tdt('Tieu_chi_danh_gia')?></td>
        <td class="poor" colspan="3" lang="<?=$array_lang[$lang_id][0]?>"><?=tdt('Kem')?></td>
        <td class="normal" colspan="3" lang="<?=$array_lang[$lang_id][0]?>"><?=tdt('Binh_thuong')?></td>
        <td class="good" colspan="2" lang="<?=$array_lang[$lang_id][0]?>"><?=tdt('Tot')?></td>
        <td class="excellent" colspan="2" lang="<?=$array_lang[$lang_id][0]?>"><?=tdt('Xuat_sac')?></td>
        <td></td>
	</tr>
    <tr class="title_bg">
    	<td align="center" width="4%">1</td>
        <td align="center" width="4%">2</td>
        <td align="center" width="4%">3</td>
        <td align="center" width="4%">4</td>
        <td align="center" width="4%">5</td>
        <td align="center" width="4%">6</td>
        <td align="center" width="4%">7</td>
        <td align="center" width="4%">8</td>
        <td align="center" width="4%">9</td>
        <td align="center" width="4%">10</td>
        <td align="center" width="4%" lang="<?=$array_lang[$lang_id][0]?>"><? //tdt('Khong_chon')?></td>
	</tr>
    <? foreach ($arrPollEstimate as $key => $value) {?>
    <tr<?=($key==6)?' class="bottom"':''?>>
    	<td class="name" lang="<?=$array_lang[$lang_id][0]?>"><?=$value?></td>
        <? for ($i=1;$i<=10;$i++) {?>
        <?
        $var_per_poll = 'per_poll_' . $key;
		?>
        <td class="vote"><input title="<?=$i?>" type="radio" id="poll_<?=$key?>_<?=$i?>" name="per_poll_<?=$key?>" value="<?=$i?>"<?=($i==$$var_per_poll)?' checked="checked"':''?> /></td>
        <? }?>
		<td class="vote_none"><input title="N/A" type="radio" name="per_poll_<?=$key?>" value="0"<?=(0==$$var_per_poll)?' checked="checked"':''?> /></td>
	</tr>
    <? }?>
    </table>
</div>
<div class="break_module"></div>
<?
$form->create_table(0, 0 , 'class="form_table" align="center"');
echo $form->text_note(str_replace('*', '<font class="form_asterisk">*</font>', tdt('Nhung_o_co_dau_sao_(*)_la_bat_buoc_phai_nhap')));
echo $form->errorMsg($gs_errorMsg);
echo $form->text(tdt('Tieu_de'), 'per_title', 'per_title', $per_title, tdt('Tieu_de'), 1, 250, '', 255, '', '', '');
echo $form->textarea(tdt('Noi_dung'), 'per_comment', 'per_comment', $per_comment, tdt('Noi_dung'), 1, 300, 150, '', '', '');
$_SESSION['session_security_code'] = generate_security_code();
echo $form->text(tdt('Ma_so_an_toan'), 'security_code', 'security_code', $security_code, tdt('Ma_so_an_toan'), 2, 65, '', 4, '', '', '<img align="absmiddle" hspace="5" src="' . $con_root_path . 'security_code.php?' . random() . '" />');
echo $form->button("submit" . $form->ec . "reset", "submit" . $form->ec . "reset", "submit" . $form->ec . "reset", tdt("Gui_di") . $form->ec . tdt("Lam_lai"), tdt("Gui_di") . $form->ec . tdt("Lam_lai"), $form->ec, "");
echo $form->hidden("action", "action", "execute", "");
echo $form->hidden("url", "url", $url, "");
$form->close_table();
$form->close_form();
unset($form);
?>
</div>
<div class="module_bottom"><div class="fl"></div><div class="fr"></div></div>